package com.jiang.daily.Q2125;

/**
 * @author Jiang
 * @version 1.0
 * @date 2025/10/27 10:58
 */
class Solution {
    public int numberOfBeams(String[] bank) {
        int pre = 0, back = 0;
        int res = 0;
        for (String s : bank) {
            for (char c : s.toCharArray()) {
                if (c == '1')
                    back++;
            }
            if (back != 0) {
                res += pre * back;
                pre = back;
                back = 0;
            }
        }
        return res;
    }
}